import request from './wrapRequest';
/**
 * 接口分类
 * @param data 
 * @returns 
 */
export interface ApiProps{
    _id: string | null;
    categoryId?: string;
    apiName: string;
    apiPath: string;
    apiType?: string;
    desc: string;
}
/**
 * 暂时不做分页
 * @returns 
 */
export const fetchList = (id: string) => {
  return  request.get<ApiProps[]>(`/admin/user/api/list/` + id);
}

/**
 * 增加接口
 * @param data 
 * @returns 
 */
export const addApi = (data: ApiProps) => {
  return  request.put<boolean>(`/admin/user/api/create`, data);
}


/**
 * 更新接口
 * @param data 
 * @returns 
 */
export const updateApi = (data: ApiProps) => {
  return  request.post<boolean>(`/admin/user/api/update`, data);
}

/**
 * 删除接口
 * @param data 
 * @returns 
 */
export const deleteApi = (data: ApiProps) => {
  return  request.delete<boolean>(`/admin/user/api/delete/`+ data._id);
}